@using Variant = MudBlazor.Variant
@using Elsa.Api.Client.Resources.WorkflowDefinitions.Models
@inherits StudioComponentBase
@if (WorkflowDefinition != null && WorkflowInstance != null)
{
    <MudTabs Elevation="0" ApplyEffectsToContainer="true">
        <MudTabPanel Text="Details">
            <Well>
                <DataPanel Data="WorkflowInstanceData" HideEmptyValues="true"/>
            </Well>
        </MudTabPanel>
        <MudTabPanel Text="Variables">
            <Well>
                <MudTable
                    T="Variable"
                    Items="WorkflowDefinition.Variables">
                    <HeaderContent>
                        <MudTh>Name</MudTh>
                        <MudTh>Type</MudTh>
                        <MudTh>Storage</MudTh>
                        <MudTh>Value</MudTh>
                    </HeaderContent>
                    <RowTemplate>
                        <MudTd>@context.Name</MudTd>
                        <MudTd>@context.GetTypeDisplayName()</MudTd>
                        <MudTd>@GetStorageDriverDisplayName(context.StorageDriverTypeName)</MudTd>
                        <MudTd>@GetVariableValue(context)</MudTd>
                    </RowTemplate>
                    <NoRecordsContent>
                        <Well>
                            No variables
                        </Well>
                    </NoRecordsContent>
                </MudTable>
            </Well>
        </MudTabPanel>
        <MudTabPanel Text="Input/output">
            <Well>
                <MudAlert Variant="Variant.Outlined">Input output</MudAlert>
            </Well>
        </MudTabPanel>
    </MudTabs>
}